package part18_解释器模式_四则运算问题;

import java.util.HashMap;

/**变量的解释器
 * @ClassName: VarExpression
 * @Author: AllenSun
 * @Date: 2020/3/9 20:32
 */
public class VarExpression extends Expression {
    private String key;

    public VarExpression(String key) {
        this.key = key;
    }

    @Override
    public int interpreter(HashMap<String, Integer> var) {
        return var.get(this.key);
    }
}
